//
//  UIImage+Lx.m
//  微博
//
//  Created by imera on 15-9-11.
//  Copyright (c) 2015年 imera. All rights reserved.
//

#import "UIImage+Lx.h"
@implementation UIImage (Lx)

+ (UIImage *)imageWithName:(NSString *)name
{
    //ios7
    if(IOS7){
        NSString *newName = [NSString stringWithFormat:@"%@_os7",name];
        UIImage *image = [UIImage imageNamed:newName];
        if (image==nil) {
            image = [UIImage imageNamed:name];
        }
        return image;
    }

    //非ios7
    return [UIImage imageNamed:name];
}

+ (UIImage *)resizeWithName:(NSString *)name
{
    return [self resizeWithName:name left:0.5 top:0.5];
}

+ (UIImage *)resizeWithName:(NSString *)name left:(CGFloat)left top:(CGFloat)top
{
    UIImage *image = [UIImage imageWithName:name];
    return [image stretchableImageWithLeftCapWidth:image.size.width * left topCapHeight:image.size.height * top];
}
@end
